/*
 * RenzoMesh.h
 *
 *  Created on: Aug 30, 2009
 *      Author: sonhua
 */

#ifndef RENZOMESH_H_
#define RENZOMESH_H_

#include "RenzoMustHave.h"
#include "RenzoVertex.h"
#include "RenzoFace.h"
#include "RenzoBoundingBox.h"
#include "RenzoPolygonGroup.h"

namespace Renzo {
	enum TriangleType {
		POINT_LIST,
		LINE_LIST,
		LINE_STRIP,
		TRIANGLE_LIST,
		TRIANGLE_STRIP,
	};


	class RENZODERER_API Mesh : public Object {
	protected:
		Mesh();		
		virtual ~Mesh();
		static Object* create();
		friend class ResourceManager;

	protected:		
		typedef std::vector<PolygonGroup*> PolygonGroupList;
		PolygonGroupList polygonGroups;
		
		BoundingBox bb;
		Matrix4 matTransform;
		
	public:
		

		/**
		 * @description
		 * Load mesh from a model file. File format depends on the file extension.
		 * Detect file format and call specific file format loading.
		 */
		//static Mesh* fromFile(String str);
		//void load(const String& file);	// load from a mesh file
		void addPolygonGroup(PolygonGroup* p);


		//virtual void update(int delta);

		virtual void transform(const Matrix4& mat);
		virtual void update(int delta);
		virtual void render();

		virtual BoundingBox* getBoundingBoxAABB();

		//virtual void copyToHardware() = 0;
		//virtual void copyToHardware(const Matrix4& transform) = 0;		
	};
}

#endif /* RENZOMESH_H_ */
